package cn.wolfcode.luowowo.article.domain;

import cn.wolfcode.luowowo.common.domain.BaseDomain;
import lombok.Getter;
import lombok.Setter;
import org.springframework.util.StringUtils;

import java.util.List;

//景点表
@Setter
@Getter
public class Scenic extends BaseDomain {
    public static final Integer STATE_HOT = 1; //热门
    public static final Integer STATE_NORMAL = 0; //普通

    private Long id;

    private String name;

    private String enName;

    private Long destId;

    //是否
    private Integer hot = STATE_NORMAL;

    private Integer commentNum;

    private Long parentId;

    //图片
    private String coverUrl;
    private String[] coverUrls;

    private Integer state;

    private String tel;

    private String url;

    private String travelTime;

    private String info;

    private String traffic;

    private String tickets;

    private String openingTime;

    private Integer type;

    private Integer deep;

    private String location;

    private String subinfo;

    //全部子景点
    private List<Scenic> sonScenics;

    //热数据
    private int replynum;  //评论数
    private int goodReplynum; //评论好评数
    private int centreReplynum; //中评数
    private int badReplynum; //差评数
    private int havePictureReplynum; //有图片的评论数


    public String[] getCoverUrls() {
        if (StringUtils.hasLength(coverUrl)) {
            return coverUrl.split(",");
        }
        return null;
    }

    public int getCoverUrlsLength() {
        return this.getCoverUrls().length;
    }

    public String getCoverUrl() {
        if (coverUrls != null) {
            return StringUtils.arrayToDelimitedString(coverUrls, ",");
        }
        return null;
    }
}